package xm.chengdu.com.beijing_211;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.github.czy1121.view.RoundButton;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import utils.SpfUtils;

public class MyNameActivity extends AppCompatActivity {

    @BindView(R.id.img_back)
    RelativeLayout imgBack;
    @BindView(R.id.textView4)
    TextView textView4;
    @BindView(R.id.fuwuqi)
    TextView fuwuqi;
    @BindView(R.id.editText4)
    EditText editText4;
    @BindView(R.id.pic)
    RelativeLayout pic;
    @BindView(R.id.About)
    RoundButton About;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_name);
        ButterKnife.bind(this);
        String namesss = (String) SpfUtils.get(this, "namesss", "");
        editText4.setText(namesss);
    }

    @OnClick({R.id.img_back, R.id.About})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.img_back:
                finish();
                break;
            case R.id.About:
                String s = editText4.getText().toString();
                if (TextUtils.isEmpty(s)) {
                    Toast.makeText(this, "Please input text！", Toast.LENGTH_SHORT).show();
                    return;

                }
                SpfUtils.put(this,"namesss",s);
                Toast.makeText(this, "Success！", Toast.LENGTH_SHORT).show();
                finish();
                break;
        }
    }


//    @OnClick(R.id.img_back)
//    public void onViewClicked() {
//        finish();
//    }
}
